﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HA.ModFlow.Domain.DomainLayer;
namespace HA.ModFlow.Controls
{
    class PCUzfCollection
    {
        public PCUzfCollection(ModFlowData mfData)
        {
            this._mfData = mfData;
            Uzf =(UZF ) mfData.SourceSinks.UzfCollection.Uzf.Clone();
            this._timePoint = new double[this.Uzf.Periods .Count + 1];
            this._timePoint[0] = 0.0;
            for (int i = 1; i <= this.Uzf.Periods.Count; i++)
            {
                this._timePoint[i] = this._timePoint[i - 1] + mfData.StressPeriods.InnerList[i - 1].PERLEN;
            }

            this._isUsePre = new List<bool>();
            foreach (bool item in mfData.SourceSinks.Evts.IsUsePrecious)
            {
                this._isUsePre.Add(item);
            }
            Uzf.IsHaveTransient = mfData.StressPeriods.IsHaveTransient;

            //应力期Index
            for (int i = 1; i <= this.Uzf.Periods.Count; i++)
            {
                this._periodIndex.Add(i);
            }
        }
        ModFlowData _mfData;

        UZF _uzf;

        public UZF Uzf
        {
            get { return _uzf; }
            set { _uzf = value; }
        }

     

      

        double[] _timePoint;

        public double[] TimePoint
        {
            get { return _timePoint; }

        }

        List<bool> _isUsePre;

        public List<bool> IsUsePre
        {
            get { return _isUsePre; }
            set { _isUsePre = value; }
        }
        List<int> _periodIndex = new List<int>();

        public List<int> PeriodIndex
        {
            get { return _periodIndex; }
        }
        /// <summary>
        /// 将数据保存回数据内存
        /// </summary>
        public void ConfirmToDataCenter()
        {

            for (int i = 0; i < this.Uzf.Periods.Count; i++)
            {
                _mfData.SourceSinks.UzfCollection.IsUsePrecious[i] = this.IsUsePre[i];
            }

            this._mfData.SourceSinks.UzfCollection.SetUZF(this._uzf);
        }
    }
}
